<HTML> 
<HEAD> 
	<TITLE>3rd Party ROBOTC Drivers</TITLE> 
<link href="tabs.css" rel="stylesheet" type="text/css"/> 
<link href="doxygen.css" rel="stylesheet" type="text/css"/> 
</HEAD> 
 
<BODY bgcolor="#ffffff" link="#000000" vlink="#000000"> 
<table width="100%" bgcolor="navy" cellspacing=0 cellpadding=1 border=0> 
<tr><td><table width="100%" bgcolor="#EEEEDD" cellspacing=0 cellpadding=3 border=0> 
<tr> 
    <td width="33%" align="left"> <img src="images/LOGO_NXT.gif" width=266 height=44 border="0" alt="Mindstorms"></td> 
    <td><b><font size="+3" color="navy">3rd Party ROBOTC Drivers</font></b></td> 
    <td align="right"> <img src="images/logo.png" width=44 height=44 border="0" alt="RobotC"></td>     
</tr> 
  <tr bgcolor="#cccc99" align="right"> 
          <td colspan=3> <font face="arial" size="-1"> [<a href=main.html>Home</a>] [<a target=_top href="https://sourceforge.net/projects/rdpartyrobotcdr/">Download</a>] [<a target=_top href="http://apps.sourceforge.net/mantisbt/rdpartyrobotcdr/my_view_page.php">Submit a bug/suggestion</a>]  [<a target=_top href="http://www.robotc.net/forums/">ROBOTC Forums</a>] [<a target=_top href="http://botbench.com">Blog</a>] [<a target=_top href="http://sourceforge.net/donate/index.php?group_id=257238">Support this project</a>]</font> </td> 
</tr> 
</table></td></tr> 
</table> 
<!-- Generated by Doxygen 1.7.2 -->
<div class="header">
  <div class="headertitle">
<h1>hitechnic-superpro-exp1.c</h1>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><span class="preprocessor">#pragma config(Sensor, S1,     HTSPB,                sensorI2CCustom9V)</span>
<span class="preprocessor"></span><span class="comment">//*!!Code automatically generated by &#39;ROBOTC&#39; configuration wizard               !!*//</span>

<span class="comment">/*   HiTechnic Experimenter&#39;s Kit for the SuperPro</span>
<span class="comment"></span>
<span class="comment">Experiment - 1 Introduction</span>
<span class="comment">Read the status of a switch and display the status on an LED</span>
<span class="comment"></span>
<span class="comment">*/</span>

<span class="preprocessor">#include &quot;<a class="code" href="hitechnic-superpro_8h.html" title="HiTechnic SuperPro Prototype Board driver.">drivers/hitechnic-superpro.h</a>&quot;</span>

task main() {
  <span class="keywordtype">int</span> inputdata;

  <span class="comment">// Set B0 for output</span>
  <a name="a0"></a><a class="code" href="group___h_t_s_p_b.html#ga9efaffb1a442aa3d1765b623536141a4">HTSPBsetupIO</a>(HTSPB, 0x1);

  <span class="keywordflow">while</span>(<span class="keyword">true</span>) {
    <span class="comment">// Read a 10bit wide analogue value from A0</span>
    inputdata = <a name="a1"></a><a class="code" href="group___h_t_s_p_b.html#gae590239d00f2a422972837fa8cda9341">HTSPBreadADC</a>(HTSPB, 0, 10);
    nxtDisplayTextLine(1, <span class="stringliteral">&quot;A0: %d&quot;</span>, inputdata);

    <span class="comment">// If A0 is less than 50% of the max value</span>
    <span class="comment">// turn off the LED, otherwise switch it on</span>
    <span class="keywordflow">if</span>(inputdata &lt; 512)
      <a name="a2"></a><a class="code" href="group___h_t_s_p_b.html#ga6d342ff5d1f49c472a445669a0363d96">HTSPBwriteIO</a>(HTSPB, 0x00);
    <span class="keywordflow">else</span>
      <a class="code" href="group___h_t_s_p_b.html#ga6d342ff5d1f49c472a445669a0363d96">HTSPBwriteIO</a>(HTSPB, 0x01);

    wait1Msec(50);
  }
}
</pre></div> </div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Mar 13 2013 19:56:42 for ROBOTC Drivers by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
